﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Classes;

namespace Classes
{
    public partial class FormLookupPadrao : Form
    {
        public Boolean retornarValor;
        public ClassLookup cLookup { get; set; }

        public FormLookupPadrao()
        {
            InitializeComponent();
        }

        public virtual void FormLookupPadrao_Load(object sender, EventArgs e)
        {
            cmbCampo.Focus();
        }

        private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            cLookup.Returning = true;
            this.Close();
        }

        private void btnConfirmar_Click(object sender, EventArgs e)
        {
            cLookup.Returning = true;
            this.Close();
        }

        private void dataGridView1_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Return) /* Enter */
            {
                cLookup.Returning = true;
                this.Close();
            }
        }

        private void FormLookupPadrao_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Escape) /* ESC */
            {
                //cLookup.Returning = true;
                this.Close();
            }
        }
    }
}
